package com.ctshk.rpc.payment.service;

import com.ctshk.common.dto.Result;
import com.ctshk.rpc.payment.enums.RefundStatus;
import com.ctshk.rpc.payment.req.CallPayReq;
import com.ctshk.rpc.payment.req.PayCommonReq;
import com.ctshk.rpc.payment.req.RefundReq;

import java.util.Map;

/**
 * @BelongsProject: ctshk-cloud
 * @BelongsPackage: com.ctshk.rpc.payment.service
 * @Author: hef
 * @CreateTime: 2021-04-20 18:01
 * @Description: 描述
 */
public interface IPayService {
    /**
     * 支付
     *
     * @param req
     * @param userId
     * @return
     */
    Result pay(PayCommonReq req, Long userId);


    Result callPay(CallPayReq callPayReq);

    /**
     * 回调
     *
     * @param paramMap
     * @return
     */
    Object callback(Map<String, String> paramMap);

    /**
     * 退款申请
     *
     * @param req
     * @return
     * @Description 该接口调用成功只能说明申请退款成功, 部分平台无法立即退款, 请判断返回参数!!
     * 如果返回状态非SUCCESS(退款成功),需要后面主动查询退款详情
     */
    RefundStatus refund(RefundReq req);

    /**
     * 轮询支付结果接口,目前值查看callback_param有没有值，有值就是支付成功
     * @param orderId
     * @return
     */
    Result<Integer> pollingPayResult(Long orderId);
}
